#ifndef MINUTE_TIMER_H
#define MINUTE_TIMER_H

#include <singleton.h>
#include <set>

class CMinuteTimerSubscriber
{
public:
    virtual void OnTrigger(time_t) = 0;
};

class CMinuteTimer : public CSingleton<CMinuteTimer>
{
    friend class CSingleton<CMinuteTimer>;
    typedef std::set<CMinuteTimerSubscriber *> TSubscribers;
public:
    // subscribe the trigger event
    void Subscribe(CMinuteTimerSubscriber * pSubscriber);
    // un-subscribe
    void UnSubscribe(CMinuteTimerSubscriber * pSubscriber);
    // notify all the subscriber
    void NotifyAll();
private:
    TSubscribers m_Subscribers;

};

#endif // endif of MINUTE_TIMER_H
